package cn.commander.controller;


import cn.commander.base.BaseController;
import cn.commander.constant.MvcResponseConstant;
import cn.commander.utils.SendEmail;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: EmailController
 * Author: zhongyi_yang <br/>
 * Description: 发送邮件
 * Version: 1.0
 * Date: 2017/2/10 15:57
 */
@RestController
@RequestMapping("/v1/emails")
public class EmailController extends BaseController {

	/**
	 * 发送邮件
	 *
	 * @param email 收件人
	 * @return 发送结果
	 */
	@RequestMapping(method = RequestMethod.GET)
	public Object sendEmail(@RequestParam("email") String email) {
		SendEmail sendEmail = new SendEmail();
		boolean result = sendEmail.sendHtmlMail(email);
		if (result) {
			return getResponseData().buildResponseData(MvcResponseConstant.CODE_00000);
		}
		return getResponseData().buildResponseData(MvcResponseConstant.CODE_99000);
	}
}
